home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
vblank1d.arc
/
VBLANK.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-10-05
|
4KB
|
119 lines
PAGE 78,132
; ---------- VBLANK VGA Screen Blanker
; ---------- Version 1d
; ---------- Placed in the public domain by
; ---------- Richard M. Utter, ProLogic, Scottsville, New York
; ---------- 3 September 1990
; ----------
; ---------- Fine Print: There's no charge. Neither is there a warranty.
; ----------
; ---------- VBLANK.EXE is a TSR designed to blank a VGA monitor after a
; ---------- fixed interval. Pressing any key will unblank the monitor. RAM
; ---------- required is about 500 bytes.
; ----------
; ---------- Assemble VBLANK.ASM with MASM 5.1. Then link VBLANK.OBJ any old
; ---------- way. Use Microsoft's EXEMOD or a similar utility to reduce
; ---------- VBLANK.EXE's memory requirement to the minimum. (For EXEMOD, the
; ---------- command would be "EXEMOD VBLANK.EXE /MAX 0".) Run VBLANK from the
; ---------- DOS command line or via AUTOEXEC.BAT.
; ----------
; ---------- Timer threshold: 5000 / 18.2 = 275 seconds or thereabouts. The
; ---------- VGA monitor will be blanked after roughly 4.5 minutes of keyboard
; ---------- inactivity.
MAXT EQU 5000
.MODEL SMALL
; ---------- "Short stack."
.STACK 16
.CODE
TSR PROC FAR
JMP SHORT _1000
OLD_1C DD 0
OLD_09 DD 0
TCOUNT DW 0
; ---------- Grab old INT 1C and 9 vectors before replacing them.
_1000: MOV AX,351CH
INT 21H
MOV WORD PTR OLD_1C,BX
MOV WORD PTR OLD_1C+2,ES
MOV AX,3509H
INT 21H
MOV WORD PTR OLD_09,BX
MOV WORD PTR OLD_09+2,ES
; ---------- Point INT 8 and 9 at our interrupt routines.
PUSH CS
POP DS
MOV AX,251CH
MOV DX,OFFSET INTTIME
INT 21H
MOV AX,2509H
MOV DX,OFFSET INTKB
INT 21H
; ---------- "Terminate and stay resident", reserving 432 bytes for ourselves.
; ---------- 432 is a bit more than 256 + 157 + 16 (PSP plus code size plus
; ---------- stack size).
MOV AX,3100H
MOV DX,27
INT 21H
TSR ENDP
; ---------- Timer ISR.
INTTIME PROC FAR
; ---------- Save DS before pointing it at local data.
PUSH DS
PUSH CS
POP DS
; ---------- Screen already blanked?
CMP TCOUNT,MAXT
; ---------- Yes. Go away.
JE _2000
; ---------- Increment and test counter.
ADD TCOUNT,1
CMP TCOUNT,MAXT
JL _2000
; ---------- We've reached the threshold. Disable VGA screen refresh.
PUSH AX
PUSH DX
MOV AL,1
MOV DX,3C4H
OUT DX,AL
INC DX
IN AL,DX
OR AL,20H
OUT DX,AL
POP DX
POP AX
; ---------- Restore DS to entry value, then vector to old timer ISR.
_2000: POP DS
JMP OLD_1C
INTTIME ENDP
; ---------- K/B ISR.
INTKB PROC FAR
PUSH DS
PUSH CS
POP DS
; ---------- Is the screen blanked? If not, unblanking it is redundant.
CMP TCOUNT,MAXT
JL _3000
; ---------- Screen is blanked. Enable VGA screen refresh.
PUSH AX
PUSH DX
MOV AL,1
MOV DX,3C4H
OUT DX,AL
INC DX
IN AL,DX
AND AL,NOT 20H
OUT DX,AL
POP DX
POP AX
; ---------- Zero the counter.
_3000: MOV TCOUNT,0
POP DS
; ---------- Vector to the real K/B ISR.
JMP OLD_09
INTKB ENDP
END TSR